<?php
/**
 * Created by PhpStorm.
 * User: tjjs
 * Date: 17-5-22
 * Time: 下午5:11
 *
 * 分类排序
 *
 */

namespace ActionsHttp;


use Data\Restaurant_DAO;

class RestaurantFoodGroupsUpdateOrder extends BaseActionHttp
{
    public function doAction() {
        parent::doAction();

        // 商铺id
        $restaurant_id = $_SESSION[RESTAURANT_ID];
        $restaurant_id = 1;

        // 商品分类排序(数组)
        $food_groups_order = $this->data[FOOD_GROUPS_ORDER];

        // 商铺记录
        $restaurant_record = Restaurant_DAO::getRecord($restaurant_id);

        if (!$restaurant_record) {
            return $this->SendErrMsg("参数错误，没有商铺记录");
        }

        // 更新
        $restaurant_record->setFOOD_GROUPS_ORDER($food_groups_order);

        // 更新数据库
        Restaurant_DAO::update($restaurant_record);

        // 返回数据
        $this->ResponseDataToCurrentClient();
    }
}